<template>
	<view
	class="bg-white u-m-t-10"
	style="padding: 28rpx 40rpx 36rpx 44rpx;">
		<view class="u-f-34 u-lh-46 font-bold">{{ lang_order.refundInfo }}</view>
		<view class="u-m-t-16 u-f-26 u-lh-36 color-grew">
			<view class="flex-center" @click="copyContent(info.refundNumber)">
				<view class="u-m-r-10">{{ lang_order.refundNumber }}: {{ info.refundNumber }}</view>
				<u-icon name="copy" custom-prefix="u" color="#999999" size="24"></u-icon>
			</view>
			
			<view
			v-for="(item, index) in orderMessages"
			:key="index"
			class="u-m-t-18">
				{{ lang_order[item.labelKey] }}: {{ item.labelKey === 'payType' ? payMethod(info.payType) : info[item.key || item.labelKey] }}
			</view>
		</view>
	</view>
</template>

<script>
	const payMethods = [
		{ key: 'score', label: '积分', value: 1 },
		{ key: 'balance', label: '余额', value: 2 },
		{ key: 'paypal', label: 'paypal', value: 3 }
	]
	export default {
		props: {
			info: {
				default: () => ({})
			}
		},
		data() {
			return {
				orderMessages: []
			}
		},
		watch: {
			info: {
				handler(v) {
					// 初始化订单信息
					let orderMessages = [];
					[
						[
							{ labelKey: 'createTime', label: '创建时间' },
						],
						[
							{ labelKey: 'payType', label: '支付方式' },
							{ labelKey: 'payTime', label: '支付时间' },
						],
						[
							{ labelKey: 'deliveryTime', key: 'shipTime', label: '发货时间' },
						],
						[
							{ labelKey: 'completeTime', key: 'receiptTime', label: '收货时间' },
						],
						[
							{ labelKey: 'evaluateTime', key: 'commentTime', label: '评价时间' }
						]
					].map((item, index) => {
						item.map(_item => {
							if (v[_item.key || _item.labelKey]) {
								orderMessages = [...orderMessages, _item]
							}
						})
					})
					this.orderMessages = orderMessages
				},
				deep: true,
				immediatee: true
			}
		},
		methods: {
			payMethod(value) {
				let result = payMethods.find(item => item.value === value) || {}
				console.log(this.lang_personal[result.key])
				return this.lang_personal[result.key] || ''
			}
		}
	}
</script>

<style scoped lang="scss">

</style>
